<body style="margin-left:0; margin-top:0">
    <script>
        function log(message)
        {
            var item = top.document.createElement("li");
            item.appendChild(document.createTextNode(message));
            top.document.getElementById("log").appendChild(item);
        }
        
        function logMouseEvent(evt)
        {
            target = (evt.target) ? evt.target : evt.srcElement;
            log(evt.type + " on " + target.id);
        }
        
        function doOnMouseOver(evt)
        {
            logMouseEvent(evt);
            document.getElementById("t2").style.backgroundColor = "white";
        }

        function doOnMouseOut(evt)
        {
            logMouseEvent(evt);
            document.getElementById("t2").style.backgroundColor = "gray";
        }
        
    </script>
    <div style="height: 50; width: 50; background:orange; top:0;left:0; position:absolute;" id="t2" 
        onMouseOver="doOnMouseOver(event);" 
        onMouseOut="doOnMouseOut(event)">2</div>
</body>
